#!/usr/bin/env bash
# setting the PS4 "DEBUG" prompt
export PS4='
DEBUG level:$SHLVL 
subshell-level: $BASH_SUBSHELL 
source-file:${BASH_SOURCE}
\033[31mline#:${LINENO} $(test -n "${FUNCNAME[0]}" && echo "function:${FUNCNAME[0]:+${FUNCNAME[0]}(): }")\033[0m
+'

# switch on debugging
set -x

# define a stupid_func
function stupid_func(){
	echo I am line 1 of stupid_func
	echo I am line 2 of stupid_func
}

# a normal statement
echo something

# function call
stupid_func

# a pipeline of commands runing in a subshell
( ls -l | grep 'using' )

ls -l | grep 'PS4'

# switch off debugging
set +x
